package main

import (
	_ "code.google.com/p/cloud9lib/js/httpd"
	"code.google.com/p/cloud9lib/mongo"
	"code.google.com/p/cloud9lib/restdb"
	_ "code.google.com/p/cloud9lib/restdb/httpd"
	_ "code.google.com/p/cloud9lib/restfs/httpd"
	_ "code.google.com/p/cloud9lib/syncd/httpd"
	"code.google.com/p/cloud9lib/index"
	"log"
	"net/http"
)

func main() {

	mongo.Open("mongodb://cloud9lib:cloud9lib@localhost/cloud9lib")
	defer mongo.Close()

	restdb.AddCollections()

	index.AddRoute("root.cloud9lib.net/", "http://localhost:1337")

	log.Println("starting server on localhost:1337 ...")
	err := http.ListenAndServe("localhost:1337", nil)

	if err != nil {
		log.Fatal("ListenAndServe: ", err)
	}
}
